package service

import (
	"backend/app/dao"
	"backend/utils/format"

	"go.uber.org/zap"
)

type mMenuTree struct {
}

func (m *mMenuTree) GetMenuTree() (data interface{}, err IServiceError) {
	menu, dbErr := dao.GetMenuTree()
	if dbErr != nil {
		zap.L().Error("mMenuTree GetMenuTree is error", zap.Error(dbErr))
		err = NewServiceError(format.CodeMenuTreeErr, dbErr.Error())
		return
	}
	data = menu
	return
}

var MenuService *mMenuTree

func init() {
	if MenuService == nil {
		MenuService = &mMenuTree{}
	}
}
